﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MedicalSystem.SmartReport.Viewer.ExtendControls
{
    public partial class QueryableDateTimePicker : DateTimePicker
    {
      

       

        public QueryableDateTimePicker()
        {
            InitializeComponent();
           
        }

       

        protected override void OnPaint(PaintEventArgs pe)
        {
          
            base.OnPaint(pe);
            
        }
        private Label _label = new Label();
        protected override void InitLayout()
        {
           
            base.InitLayout();
            int width = Convert.ToInt32(_label.CreateGraphics().MeasureString(_label.Text, _label.Font).Width);
            _label.Location = new Point(this.Left - width, this.Top+2);
            _label.Width = width;
            _label.Parent = this.Parent;
           
        }

        protected override void OnLocationChanged(EventArgs e)
        {
           
            int width=Convert.ToInt32(_label.CreateGraphics().MeasureString(_label.Text,_label.Font).Width);
            _label.Location = new Point(this.Left - width, this.Top+2);
            _label.Width = width;
            _label.Parent = this.Parent;
            base.OnLocationChanged(e);
        }

       public string Caption
        {
            get { return _label.Text; }
            set {
                _label.Text = value;
                int width = Convert.ToInt32(_label.CreateGraphics().MeasureString(_label.Text, _label.Font).Width);
                _label.Location = new Point(this.Left - width, this.Top + 2);
                _label.Width = width;
                _label.Parent = this.Parent;

                }
        }
       
        public Label Lable
        {
            get { return this._label; }
            set { this._label = value; }
        }
       
    }
}
